package net.eascn.babyClone.commands
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import net.eascn.babyClone.business.SaveAlbumInstanceDelegate;
	import net.eascn.babyClone.model.ModelLocator;

	public class SaveAlbumInstanceCommand implements ICommand, IResponder
	{
		private var model : ModelLocator = ModelLocator.getInstance();
		private var _delagae:SaveAlbumInstanceDelegate = new SaveAlbumInstanceDelegate(this as IResponder);


		public function execute(event:CairngormEvent):void
		{
			_delagae.save()
		}
		
		public function result(data:Object):void
		{
			trace(data);
			var result:XML =  data.result;
			if(result.code == 0)
				Alert.show(String(result.message));
			else 
				Alert.show(String(result.message));
		}
		
		public function fault(info:Object):void
		{
			Alert.show('保存失败');
		}
		
	}
}